<%--
    Document   : loancollection
    Created on : Apr 6, 2011, 3:37:32 PM
    Author     : Dine
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">

<%@ taglib prefix="s" uri="/struts-tags"%>
<%@ taglib prefix="sj" uri="/struts-jquery-tags"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>

<html>
    <head>
        <sj:head jqueryui="true" jquerytheme="south-street" compressed="false"/>
        <jsp:include page="WEB-INF/fragments/globalHead.html"/>
        <title>Cashmate <s:property value="#session.branch.branchname"/> - Loan Request</title>
        <style type="text/css">
            .inputContainer{
                position:relative; float:left;
            }
        </style> <!--main.jsp css-->
        <script type="text/javascript">
            
            function viewCreated() {
                window.location = "loanrequest.jsp?cat=gridloanappliposted";
            }
            function backToCreateReq() {
                window.location = "loanrequest.jsp?cat=loanappli";
            }
        </script> <!--main.jsp script-->
    </head>
    <body>

        <c:if test="${sessionScope.auth == null || sessionScope.auth == false}">
            <%--<jsp:forward page="index.jsp?auth=none"/>--%>
        </c:if>
        <s:action name="query-privilege" executeResult="false" var="privilege1c">
            <s:param name="moduleid">4</s:param>
            <s:param name="privilege">c</s:param>
            <s:param name="pagename">loanrequest</s:param>
        </s:action>
        <s:action name="get-areascoll" executeResult="false" var="a"/>
        <s:action name="get-products" executeResult="false" var="p"/>
        <s:div id="bodyContainer">
            <s:div id="logoContainer" cssClass="ui-widget-content ui-corner-all">
                <s:include value="WEB-INF/fragments/banner.jsp">
                    <s:param name="branch" value="#session.branch.branchname" />
                </s:include>
            </s:div>
            <jsp:include page="WEB-INF/fragments/top.jsp"/>
            <jsp:include page="WEB-INF/fragments/mainMenu.jsp?menu=Loan"/>
            <jsp:include page="WEB-INF/fragments/left.jsp?type=loan&innerType=loanrequest&select1=subMenuLoanRequest&select2=loanRequestSubMenu_${param.cat}"/>

            <s:div id="contentContainer" cssClass="ui-widget-content ui-corner-all">
                <h1 id="contentHeader" class="ui-state-default ui-corner-all"></h1>
                <s:div id="theContent">

                    <c:if test="${param.cat == 'branchcash'}">
                        <script type="text/javascript">
                            $('h1#contentHeader').html('<span id="level1">Create Request</span>');
                        </script>
                        <c:choose>
                            <c:when test="${param.selected == null}">
                                <jsp:include page="WEB-INF/fragments/loanRequest.jsp"/>
                            </c:when>
                            <c:otherwise>
                                <jsp:include page="WEB-INF/fragments/request.jsp"/>
                            </c:otherwise>
                        </c:choose> 
                    </c:if>
                    <c:if test="${param.cat == 'branchman'}">
                        <script type="text/javascript">
                            $('h1#contentHeader').html('<span id="level1">Send Request</span>');
                        </script>
                        <jsp:include page="WEB-INF/fragments/branch.jsp"/>
                    </c:if>
                    <c:if test="${param.cat == 'headoffice'}">
                        <script type="text/javascript">
                            $('h1#contentHeader').html('<span id="level1">Head Office Cash Custodian</span>');
                        </script>
                        <jsp:include page="WEB-INF/fragments/headoffice.jsp"/>
                    </c:if>  
                    <!--<c:if test="${param.cat == 'head'}">
                        <script type="text/javascript">
                            $('h1#contentHeader').html('<span id="level1">Head Cash Custodian</span>');
                        </script>
                        <jsp:include page="WEB-INF/fragments/headoffice.jsp"/>
                    </c:if> 
                    <c:if test="${param.cat == 'acctclerk'}">
                        <script type="text/javascript">
                            $('h1#contentHeader').html('<span id="level1">Accounting Clerk</span>');
                        </script>
                        <jsp:include page="WEB-INF/fragments/headoffice.jsp"/>
                    </c:if>--> 
                    <!--                added by shine-->
                    <c:if test="${param.cat == 'loanappli'}">
                        <s:if test="%{#privilege1c.allowable == false}">
                            <script type="text/javascript">window.location="unauthorized.html";</script>
                            <% System.out.println("hello");%>
                        </s:if>
                        <s:else>
                            <% System.out.println("bye");%>
                            <script type="text/javascript">
                                $('h1#contentHeader').html('<span id="level1">Create Request</span>');
                            </script>
                            <s:action name="get-borrowers" executeResult="false" var="e"/>
                            <jsp:include page="WEB-INF/fragments/loanapplicationcontent.jsp" />
                        </s:else>
                    </c:if>
                    <c:if test="${param.cat == 'gridloanappliposted'}">
                        <script type="text/javascript">
                            $('h1#contentHeader').html('<span id="level1">Created Requests</span>');
                        </script>
                        <s:div cssStyle="height: 470px">
                            <jsp:include page="WEB-INF/fragments/admin/loanapp.jsp?cat=posted" />
                        </s:div>
                        <s:div id="buttons" cssStyle="float:right">
                            <sj:a
                                name="viewCreatedReqs"
                                id="viewCreatedReqs"
                                onclick="backToCreateReq()"
                                button="true"
                                cssStyle="float:left;margin-top:2px;font-size:12px !important;font-family: Tahoma, Geneva, sans-serif !important;"
                                >
                                Back
                            </sj:a>
                        </s:div>
                    </c:if>
                    <!--                end of added by shine-->
                </s:div>

            </s:div>
            <jsp:include page="WEB-INF/fragments/bottom.jsp"/>
        </s:div>
    </body>
</html>
